package test19.homework;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

public class Homework02 {
    public static void main(String[] args) throws IOException {
        //要求:使用BufferedReader读取一个文本文件，为每行加上行号，
        //再连同内容一并输出到屏幕上。
        String filePath = "d:\\a.txt";
        String data = "";
        int count = 0;
        BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath));
        while ((data = bufferedReader.readLine()) != null){
            System.out.println(++count + data);
        }
        bufferedReader.close();
    }
}
